"""
歌词识别服务使用示例
"""
import asyncio
from mcp.client import MCPClient

async def recognize_song_example():
    """
    示例：通过歌词识别歌曲
    """
    # 初始化客户端
    client = MCPClient("lyrics-recognition")
    
    # 示例歌词（陶喆《爱我还是他》片段）
    lyrics = "你爱我还是他"
    print(f"输入歌词片段: \"{lyrics}\"")
    
    try:
        # 调用歌词识别服务
        result = await client.call("recognize_song_by_lyrics", lyrics)
        
        # 打印完整结果
        print("\n完整歌曲信息:")
        print(f"歌曲: {result.get('title')}")
        print(f"歌手: {result.get('artist')}")
        print(f"专辑: {result.get('album')}")
        print(f"发行年份: {result.get('release_year')}")
        print("\n完整歌词:")
        print(result.get('lyrics'))
        
        return result
    except Exception as e:
        print(f"识别失败: {str(e)}")
        return None

if __name__ == "__main__":
    asyncio.run(recognize_song_example())